<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<tiles:insertDefinition name="layout">
	<tiles:putAttribute name="head">
		<script type="text/javascript">
			$(function() {
				//Validform库的应用
				$("form").Validform({
					ajaxPost : true,
					customReset : true,
					tiptype : ValidUtils.siblingTip,
					datatype : ValidUtils.types("name", "title"),
					callback : function(data) {
						helper.showMsg(data, {
							okHandler : function() {
								location.href = "listUser";
							}
						});
					}
				});
			});
		</script>
	</tiles:putAttribute>
	<tiles:putAttribute name="mainBody">
		<ul class="breadcrumb">
			<li><a href="listUser">用户列表</a> <span class="divider">/</span></li>
			<li class="active">查看用户</li>
		</ul>
		<form class="form-horizontal">
			<input type="hidden" name="id" value="${user.id}" />
			<div class="control-group">
				<label class="control-label">
					名称<span style="color: #F00">*</span>
				</label>
				<div class="controls">
					<input type="text" name="name" value="${user.name}" disabled="disabled" /> <span class="Validform_checktip"></span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">
					概述<span style="color: #F00">*</span>
				</label>
				<div class="controls">
					<input type="text" name="title" value="${user.title}" disabled="disabled" /> <span class="Validform_checktip"></span>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label">
					所属角色<span style="color: #F00">*</span>
				</label>
				<div class="controls">
					<s:checkboxlist name="roleId" theme="simple" list="#roles" listKey="id" listValue="title" value="#user.roles.{id}"
						disabled="true"></s:checkboxlist>
					<span class="Validform_checktip"></span>
					<h3>拥有权限</h3>
					<ul>
						<s:iterator value="#privileges" var="privilege">
							<li><label class="checkbox">
									<input type="checkbox" <s:if test="#privilege.id in #grants.{id}">checked="checked"</s:if> disabled="disabled"
										value="${privilege.id}">${privilege.title}
								</label></li>
						</s:iterator>
					</ul>

					<div>
						<a href="changePwd?id=${user.id}">修改密码</a>
					</div>
				</div>
			</div>
		</form>
	</tiles:putAttribute>
</tiles:insertDefinition>